package com.hnkywl.jip.service;

import com.hnkywl.jip.dao.UserDao;
import com.hnkywl.jip.utils.UserData;
import net.ruixin.orm.hibernate.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: jerry
 * Date: 13-3-11
 * Time: 上午11:40
 * To change this template use File | Settings | File Templates.
 */
@Service
public class UserService {
    private UserDao userDao;

    @Transactional
    public Page<Object[]> searchUserMapping(String userName,Integer start,Integer limit){
        return this.userDao.searchUserMapping(userName, start, limit);
    }

    @Transactional
    public void saveUserMapping(List<UserData> userDataList){
        for(UserData userData:userDataList)
            this.userDao.saveUserMapping(userData);
    }

    @Autowired
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
